package com.gs.process.demo.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gs.process.demo.mapper.LeavesMapper;
import com.gs.process.demo.model.Leaves;
import com.gs.process.core.annotation.ProcessBegin;
import com.gs.process.core.annotation.ProcessEntry;
import com.gs.process.core.user.ProcessUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Shuai Guo
 * @version 1.0
 * @description
 * @date 2021/7/13
 */
@Service
public class LeavesService extends ServiceImpl<LeavesMapper, Leaves> {

    @Resource
    private LeavesMapper leavesMapper;
    @Resource
    private ProcessUserService processUserService;

    @ProcessBegin(value = "leaves")
    public boolean save(@ProcessEntry(primaryKey = "leavesId", processField = "flowId", underscoreToCamelCase = true) Leaves leaves) {
        return leavesMapper.insert(leaves) > 0;
    }

    public void find() {
        System.out.println(processUserService.get());
    }
}
